/**
 *  @file SDLTypeSetter.h
 *
 *  @date 29-nov-2009
 *  @author Ives van der Flaas
 */

#ifndef SDLTYPESETTER_H_
#define SDLTYPESETTER_H_

#include <tr1/memory>
#include <SDL.h>
#include <string>
#include "SDLColor.h"
#include "SDLResourceManager.h"


namespace si_sdl
{

/**
 * Specifies alignment for text to be typeset...
 */
enum TextAlignment { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT };

/**
 * Singelton that can typeset a text
 */
class SDLTypeSetter
{
public:
	static std::tr1::shared_ptr<SDLTypeSetter> get()
	{
		static std::tr1::shared_ptr<SDLTypeSetter> typesetter;
		return typesetter;
	}
	virtual ~SDLTypeSetter();

	/**
	 * Typesets and entire text. Understands newlines...
	 * @param text Text to be typeset
	 * @param fontlocation Where I can find the font you would like to use
	 * @param ptSize Size of the font in points
	 * @param fontColor The font's color
	 * @param bgColor The background's color
	 * @param align One of the TextAlignment options
	 * @return A shared_ptr to the SDL_Surface that contains the text
	 */
	std::tr1::shared_ptr<SDL_Surface> typesetText(
			std::string text,
			std::string fontlocation,
			int ptSize,
			Color fontColor,
			Color bgColor,
			TextAlignment align);

	std::tr1::shared_ptr<SDL_Surface> typesetLine(
				std::string text,
				std::string fontlocation,
				int ptSize,
				Color fontColor,
				Color bgColor);

private:
	SDLTypeSetter(){}
};

}

#endif /* SDLTYPESETTER_H_ */
